package com.innovation.chengzhangriji.ui.widget;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.FrameLayout;

import com.innovation.chengzhangriji.R;

public class TimelineTextView extends FrameLayout {

    private CuteTextView mTextText;

    public TimelineTextView(Context context) {
        super(context);
        init(context);
    }

    public TimelineTextView(Context context, AttributeSet attrs) {
        super(context, attrs);
        init(context);
    }

    public TimelineTextView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        init(context);
    }

    public void setText(String text) {
        mTextText.setText(text);
    }

    private void init(Context context) {
        setBackgroundDrawable(getResources().getDrawable(R.drawable.bg_card));
        float density = getResources().getDisplayMetrics().density;
        int padL = (int) (16 * density);
        int padR = (int) (14 * density);
        int padY = (int) (12 * density);
        setPadding(padL, padY, padR, padY);
        LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        inflater.inflate(R.layout.layout_timeline_text, this);
        mTextText = (CuteTextView) findViewById(R.id.text_text);
    }
}
